package com.livery.app.main;

import java.util.List;

import javax.swing.SwingUtilities;

import org.hibernate.Query;
import org.hibernate.Session;

import com.livery.app.controller.AbstractWorkspaceController;
import com.livery.app.controller.WorkspaceController;
import com.livery.app.model.AbstractWorkspaceModel;
import com.livery.app.model.WorkspaceModel;
import com.livery.data.Car;
import com.livery.data.Supervisor;
import com.livery.data.Worker;
import com.livery.login.LoginView;
import com.livery.login.SessionContext;

public class RunLivery {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		(new Thread(new Runnable() {
			
			@Override
			public void run() {
				HibernateUtil.getSessionFactory();
				
			}
		})).start();
		
		
		
		SwingUtilities.invokeLater(new Runnable() {
			
			@Override
			public void run() {
				
				LoginView lv = new LoginView();
				
				lv.setVisible(true);
				
				if(SessionContext.getInstance().getWorker()!=null){
					
						AbstractWorkspaceModel model = new WorkspaceModel();
						AbstractWorkspaceController controller = new WorkspaceController(model);
					
				}else{
					System.exit(0);
				}
				
            }
        });
	}

}
